<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>用户注册信息验证</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 40px;
        }

        form {
            margin: 20px;
            padding: 20px;
            border: 1px solid #ccc;
        }

        input[type="text"],
        input[type="password"],
        input[type="email"] {
            margin-bottom: 10px;
            display: block;
        }

        button {
            cursor: pointer;
        }
    </style>
</head>
<body>
    <h2>用户注册</h2>
    <form id="registrationForm">
        <label for="username">用户名:</label>
        <input type="text" id="username" name="username" required><br><br>
        
        <label for="password">密码:</label>
        <input type="password" id="password" name="password" required><br><br>
        
        <label for="email">邮箱:</label>
        <input type="email" id="email" name="email" required><br><br>
        
        <button type="submit">用户注册</button>
    </form>
    <script>
        document.getElementById('registrationForm').addEventListener('submit', function(event) {
            event.preventDefault(); // 阻止表单默认提交行为

            // 获取用户输入
            var username = document.getElementById('username').value;
            var password = document.getElementById('password').value;
            var email = document.getElementById('email').value;

            // 用户名验证
            if (username.length < 6) {
                alert('用户名至少需要6个字符');
                return;
            }

            // 密码验证
            if (password.length < 6) {
                alert('密码至少需要6个字符');
                return;
            }

            // 邮箱验证
            if (!email.includes('@')) {
                alert('请输入有效的邮箱地址');
                return;
            }

            // 如果验证通过，可以在这里发送数据到服务器
            console.log('注册信息:', { username, password, email });
            alert('注册成功！');
        });
    </script>
</body>
</html>